package org.lq.dlz.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.lq.dlz.dao.Coupon_categoryDao;
import org.lq.dlz.entity.Coupon_category;
import org.lq.dlz.util.JDBCUtils;

public class Coupon_categoryDaoImpl implements Coupon_categoryDao {

	private QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());
	
	@Override
	public int addCoupon_category(Coupon_category cate) {
		String sql="INSERT INTO `dlz_shopping`.`coupon_category`(`coupon_id`, `product_category_id`, `producnt_category_name`, `parent_category_name`) VALUES (?,?,?,?)";
		try {
			return qr.update(sql, cate.getCoupon_id(),cate.getProduct_category_name(),cate.getProduct_category_name(),cate.getParent_category_name());
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}

}
